package com.zwd.cases.demo.gof23.decorator;

/**
 * @Description 使用装饰器模式给圆形添加红色边框和蓝色填充
 * @Author zhengwd
 * @Date 2023/4/11 9:59
 **/
public class DecoratorPatternDemo {
    public static void main(String[] args) {
        // 创建一个圆形对象
        Shape circle = new Circle();

        // 给圆形添加红色边框
        Shape redBorderCircle = new RedBorderDecorator(circle);
        redBorderCircle.draw();

        // 给圆形添加蓝色填充
        Shape blueFillCircle = new BlueFillDecorator(circle);
        blueFillCircle.draw();

        // 给圆形同时添加红色边框和蓝色填充
        Shape redBorderAndBlueFillCircle = new BlueFillDecorator(new RedBorderDecorator(circle));
        redBorderAndBlueFillCircle.draw();
    }
}